home *** CD-ROM | disk | FTP | other *** search
/ Aminet 12 / Aminet 12 (1996)(GTI - Schatztruhe)[!][Jun 1996].iso / Aminet / misc / edu / Calgor.lha / Cal / Algorithms / if_else.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-03-19  |  1.6 KB  |  63 lines

  1. #include<hold/anim.h>
  2.  
  3. /* 000 */ void ifelse_control(void){
  4. /* 001 */ int parta = 0;
  5. /* 002 */ int partb = 0;
  6.           a_func("ifelse_control",0);
  7.           a_intini(parta,"parta",1);
  8.           a_intini(partb,"partb",2);
  9.           a_intcomp("parta==0",3);
  10. /* 003 */    if(parta==0){
  11. /* 004 */      partb=1;
  12.                a_intass("partb","1",4);
  13. /* 005 */    }
  14.              a_intcomp("partb!=1",6);
  15. /* 006 */    if(partb!=1){
  16. /* 007 */      parta=1;
  17.                a_intass("parta","1",7);
  18. /* 008 */    }
  19. /* 009 */    else{
  20.                a_show(9);
  21. /* 010 */      parta=2;
  22.                a_intass("parta","2",10);
  23. /* 011 */    }
  24.              a_intcomp("parta>1",12);
  25. /* 012 */    if(parta>1){
  26.                a_intcomp("partb>=2",13);
  27. /* 013 */      if(partb>=2){
  28. /* 014 */        partb=3;
  29.                  a_intass("partb","3",14);
  30. /* 015 */      }
  31. /* 016 */      else{
  32.                  a_show(16);
  33. /* 017 */        partb=0;
  34.                  a_intass("partb","0",17);
  35. /* 018 */      }
  36. /* 019 */    }
  37. /* 020 */    else{
  38.                a_show(20);
  39.                a_intcomp("partb==1",21);
  40. /* 021 */      if(partb==1){
  41. /* 022 */        partb=3;
  42.                  a_intass("partb","3",22);
  43. /* 023 */      }
  44. /* 024 */      else{
  45.                  a_show(24);
  46. /* 025 */        partb=4;
  47.                  a_intass("partb","4",25);
  48. /* 026 */      }
  49. /* 027 */    }
  50.              a_intcomp("partb",28);
  51. /* 028 */    if(partb){
  52. /* 029 */      parta=3;
  53.                a_intass("parta","3",29);
  54. /* 030 */    }
  55. /* 031 */    else{
  56.                a_show(31);
  57. /* 032 */      parta=4;
  58.                a_intass("parta","4",32);
  59. /* 033 */    }
  60.              a_endfunc("ifelse_control",34);
  61. /* 034 */ }
  62.  
  63.